{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "cats_and_dogs.ipynb",
      "version": "0.3.2",
      "provenance": [],
      "collapsed_sections": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/wx-chevalier/AIDL-Workbench/blob/master/datasets/animals/cats_and_dogs.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "FRRkXMLYgc_1",
        "colab_type": "code",
        "outputId": "8b5930f5-8d40-4249-c5ca-4d904f6d173b",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 88
        }
      },
      "source": [
        "from google.colab import drive\n",
        "drive.mount(\"/content/drive\")\n",
        "\n",
        "print('Files in Drive:')\n",
        "!ls /content/drive/'My Drive'"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n",
            "Files in Drive:\n",
            "'Colab Notebooks'   Data   Web\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "t_fh0McPgEPU",
        "colab_type": "code",
        "outputId": "2112f26a-dcd3-43f1-c625-01467326b843",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 303
        }
      },
      "source": [
        "# we will download the cats and dogs dataset and unzip them\n",
        "# after this run, set your data_dir variable: data_dir = 'Cat_Dog_data'\n",
        "# so all the data is available. so path to your training data becomes `Cat_Dog_data/train`\n",
        "# path to test is `Cat_Dog_data/test`\n",
        "\n",
        "%env DIR=/content/drive/My Drive/Data/animals\n",
        "\n",
        "!rm -rf \"$DIR\"\n",
        "!mkdir -pv \"$DIR\"\n",
        "!wget -O \"$DIR\"/cats_and_dogs.zip https://s3.amazonaws.com/content.udacity-data.com/nd089/Cat_Dog_data.zip\n",
        "\n",
        "# remove existing directories\n",
        "!(cd \"$DIR\" && unzip -qqj cats_and_dogs.zip -d .)\n"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "env: DIR=/content/drive/My Drive/Data/animals\n",
            "^C\n",
            "--2019-06-15 14:55:45--  https://s3.amazonaws.com/content.udacity-data.com/nd089/Cat_Dog_data.zip\n",
            "Resolving s3.amazonaws.com (s3.amazonaws.com)... 52.216.101.61\n",
            "Connecting to s3.amazonaws.com (s3.amazonaws.com)|52.216.101.61|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 580495262 (554M) [application/zip]\n",
            "Saving to: ‘/content/drive/My Drive/Data/animals/cats_and_dogs.zip’\n",
            "\n",
            "/content/drive/My D 100%[===================>] 553.60M  41.2MB/s    in 15s     \n",
            "\n",
            "2019-06-15 14:56:01 (35.9 MB/s) - ‘/content/drive/My Drive/Data/animals/cats_and_dogs.zip’ saved [580495262/580495262]\n",
            "\n",
            "replace ./.DS_Store? [y]es, [n]o, [A]ll, [N]one, [r]ename: N\n",
            "n\n",
            "n\n",
            "n\n"
          ],
          "name": "stdout"
        }
      ]
    }
  ]
}